/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tabelamodelcolumnmodel.cheque;

import eloma.classe.SaidaCheques;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Icaro
 */
public class SaidaChequeTableModel extends AbstractTableModel {

    private List<SaidaCheques> listCheques;
    private boolean ordenarPorNome = true;

    public SaidaChequeTableModel(List<SaidaCheques> listCheques) {
        this.listCheques = listCheques;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        SaidaCheques cheques = listCheques.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return cheques.getNumeroCheque();
            case 1:
                return cheques.getDescricao();
            case 2:
                return cheques.getValorCheque();
            case 3:
                return cheques.getSituacao();
        }

        return null;
    }

    @Override
    public int getRowCount() {
        return listCheques.size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    public SaidaCheques getValoresSaidaCheque(int rowIndex) {
        return listCheques.get(rowIndex);
    }

    public boolean isOrdenarPorNome() {
        return ordenarPorNome;
    }

    public void setOrdenarPorNome(boolean ordenarPorNome) {
        this.ordenarPorNome = ordenarPorNome;
    }
}
